<?php
//添加團購頁面
include("../common.inc.php");
InitGP(array("action")); //初始化變量全局返回
include("function_common.php");

$titlestr="批量添加團購卷信息";
//初始化對象
include(INC_PATH."/groupbond.class.php");
$gb=new GroupBondClass();

if(empty($action)){
	InitGP(array("gid")); //初始化變量全局返回
	//顯示添加表單
	include("tpl/groupbond_adds.htm");
}elseif ($action=="save"){
	InitGP(array("gid","cnum","len","type","snpre","password","endtime")); //初始化變量全局返回
	if(isset($gid)){
		//處理數據
		$gid=GetNum($gid);
		$cnum=GetNum($cnum);
		$len=GetNum($len);
		$snpre=Char_cv($snpre);
		$type=Char_cv($type);
		$password=$password=1?1:0;
		$endtime=strtotime($endtime);
		$info=$gb->adds($gid,$cnum,$snpre,$len,$endtime,$password,$type);
		if($info=="OK"){
			showmsg("批量添加團購卷成功!","groupbond_list.php");//成功
		}else showmsg($info,"groupbond_add.php");//出錯！
	}else showmsg("缺少參數","groupbond_add.php");//出錯！
}


?>